package com.example.supernote.data.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import androidx.room.Update
import com.example.supernote.data.entity.FileEntity
import kotlinx.coroutines.flow.Flow

@Dao
interface FileEntityDao {
    @Insert
    suspend fun insert(file: FileEntity)

    @Update
    suspend fun update(file: FileEntity)

    @Query("DELETE from file WHERE id = :id")
    suspend fun deleteById(id: Int)

    @Query("SELECT * from file WHERE id = :id")
    suspend fun getItem(id: Int): FileEntity

    @Query("SELECT * from file")
    fun getAllItems(): Flow<List<FileEntity>>
}